﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MsTestUtilities.RowTests;
using MsTestUtilities;

namespace MsTestUtilitiesTests.RowTests.TestScenarioBuilderTests
{
    [TestClass]
    public class EqualityExpectationTests
    {
        [TestMethod]
        public void EqualityExpectationFails()
        {
            ExAssert.Throws<AssertFailedException>(() => Test(1, 2));
        }

        [TestMethod]
        public void ActualIsNull_FailAssertion()
        {
            ExAssert.Throws<AssertFailedException>(() => Test(1, null));
        }

        [TestMethod]
        public void EqualityExpectationHolds()
        {
            Test(1, 1);
        }

        private void Test(int? expected, int? actual)
        {
            new TestScenarioBuilder<int?, int?>()
                .For(g => g)
                .Given(actual).Expect(expected).Fact
                .Evaluate();
        }
    }
}
